﻿using UnityEngine;
using System.Collections;
using System.Collections.Generic;

namespace DungeonGenerator
{
    public class MockService : IService
    {
        List<Monster> monsterList;
        List<Player> playerList;

        public Player ShowPlayer()
        {
            //Debug.Log(playerList.Count);
            int play = Random.Range(0, playerList.Count);
            Player pemain = playerList[play];
            Debug.Log(pemain.NamaPlayer);

            return pemain;
        }

        public Monster Getheart(int level)
        {
            //Debug.Log("jumlah monster: " + monsterList.Count);
            int rand = Random.Range(0, monsterList.Count);
            //Debug.Log("random index: " + rand);
            Monster monster = monsterList[rand];
            monster.TotalStat *= (Mathf.CeilToInt(level / 10));

            return monster;
        }

        public MockService()
        {
            playerList = new List<Player>(5);
            monsterList = new List<Monster>(10);

            InstantiatePlayer();
            InstantiateMonster();
        }

        void InstantiatePlayer()
        {
            Player pemain = new Player();
            pemain.IdPlayer = 123;
            pemain.NamaPlayer = "Nabilah";
            pemain.LevelMax = 44;
            pemain.UnitPlayer = 200;
            playerList.Add(pemain);

            pemain = new Player();
            pemain.IdPlayer = 124;
            pemain.NamaPlayer = "Febi";
            pemain.LevelMax = 22;
            pemain.UnitPlayer = 100;
            playerList.Add(pemain);

            pemain = new Player();
            pemain.IdPlayer = 125;
            pemain.NamaPlayer = "Afrizal";
            pemain.LevelMax = 33;
            pemain.UnitPlayer = 150;
            playerList.Add(pemain);

            pemain = new Player();
            pemain.IdPlayer = 126;
            pemain.NamaPlayer = "Hizkia";
            pemain.LevelMax = 15;
            pemain.UnitPlayer = 70;
            playerList.Add(pemain);

            pemain = new Player();
            pemain.IdPlayer = 127;
            pemain.NamaPlayer = "Remy";
            pemain.LevelMax = 7;
            pemain.UnitPlayer = 50;
            playerList.Add(pemain);
        }

        void InstantiateMonster()
        {
            Monster monster = new Monster();
            monster.IdMonster = 100;
            monster.NamaMonster = "Thunder Bird";
            monster.TotalStat = 76;
            monsterList.Add(monster);

            monster = new Monster();
            monster.IdMonster = 101;
            monster.NamaMonster = "Felire";
            monster.TotalStat = 79;
            monsterList.Add(monster);

            monster = new Monster();
            monster.IdMonster = 102;
            monster.NamaMonster = "Nagapi";
            monster.TotalStat = 90;
            monsterList.Add(monster);

            monster = new Monster();
            monster.IdMonster = 103;
            monster.NamaMonster = "Magia";
            monster.TotalStat = 44;
            monsterList.Add(monster);

            monster = new Monster();
            monster.IdMonster = 104;
            monster.NamaMonster = "Sothetia";
            monster.TotalStat = 55;
            monsterList.Add(monster);

            monster = new Monster();
            monster.IdMonster = 105;
            monster.NamaMonster = "Amya";
            monster.TotalStat = 62;
            monsterList.Add(monster);

            monster = new Monster();
            monster.IdMonster = 106;
            monster.NamaMonster = "Lozwei";
            monster.TotalStat = 77;
            monsterList.Add(monster);

            monster = new Monster();
            monster.IdMonster = 107;
            monster.NamaMonster = "Tetravort";
            monster.TotalStat = 99;
            monsterList.Add(monster);

            monster = new Monster();
            monster.IdMonster = 108;
            monster.NamaMonster = "Kardoross";
            monster.TotalStat = 38;
            monsterList.Add(monster);

            monster = new Monster();
            monster.IdMonster = 109;
            monster.NamaMonster = "Linn";
            monster.TotalStat = 91;
            monsterList.Add(monster);
        }
    }
}
